package model

import (
	"time"
)

type AccountFillAble struct {
	Username  string `json:"username" gorm:"comment:登录名"`
	Password  string `json:"password" gorm:"comment:密码"`
	OriginPwd string `json:"origin_pwd" gorm:"comment:原密码"`
	Status    *int   `json:"status" gorm:"comment:状态"`
	CompanyId uint   `json:"company_id" gorm:"comment:所属组织"`
}

type AccountPasswordFillAble struct {
	Username  string `json:"username" gorm:"comment:登录名"`
	Password  string `json:"password" gorm:"comment:密码"`
	OriginPwd string `json:"origin_pwd" gorm:"comment:原密码"`
}

func (Account) TableName() string {
	return "accounts"
}

type Account struct {
	ID        uint `gorm:"primarykey;comment:自增ID"`
	CreatedAt time.Time
	UpdatedAt time.Time
	AccountFillAble
	ShopId            uint   `json:"shop_id" gorm:"comment:店铺ID"`
	CompanyName       string `json:"company_name" gorm:"-"`
	FordealShopName   string `json:"fordeal_shop_name" gorm:"comment:-"`
	FordealShopNameEn string `json:"fordeal_shop_name_en" gorm:"comment:-"`
	ShopName          string `json:"shop_name" gorm:"comment:-"`
}

type AccountWithChecked struct {
	Account
	Checked bool `json:"checked" gorm:"-"`
}

type AccountShopStatistics struct {
	Account
	ShopStatistics ShopStatistics `json:"shopStatistics" gorm:"foreignKey:shop_id;references:shop_id"`
	ShopStatisticsYesterday ShopStatisticsYesterday `json:"shopStatisticsYesterday" gorm:"foreignKey:shop_id;references:shop_id"`
}

type AccountShopSaleStatistics struct {
	Account
	ShopSaleStatistics ShopSaleStatistics `json:"shopSaleStatistics" gorm:"foreignKey:shop_id;references:shop_id"`
}
